//
// Created by xili on 2024/10/12 10:02.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int duplicateNumbersXOR(vector<int> &nums) {
        unordered_set<int> us;
        int ans = 0;
        for (auto &it: nums) {
            if (us.count(it)) {
                ans ^= it;
            }
            us.insert(it);
        }
        return ans;
    }
};